package com.zx.mobile.controller;

import com.zx.map.service.MerchantInfoService;
import com.zx.map.service.model.MerchantInfoDetailModel;
import com.zx.mobile.SessionHelper;
import com.zx.mobile.domain.MobileUserDomain;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2016/4/29.
 */
public class MobileControlHelper {

    /**
         * 获取用户信息 并session保存
         *
         * @param merchantId
         * @param sessionId
         * @param request
         * @return
         */
        public static MobileUserDomain reloadSessionInfoByMerchantId(MerchantInfoService merchantInfoService,String merchantId,String sessionId,
                                                               HttpServletRequest request) {
            MobileUserDomain user = new MobileUserDomain();
            MerchantInfoDetailModel detail = merchantInfoService
                    .getMerchantDetail(merchantId);
            user.setMerchantInfoDetailModel(detail);
            user.setKeepKey(sessionId);
            request.getSession().setAttribute(SessionHelper.MOBILEUSER, user);
            return user;
        }
}
